package com.blb.logistics_system.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.blb.logistics_system.entity.Logistics;
import com.blb.logistics_system.service.LogisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class LogisticsController {

    @Autowired
    private LogisticsService logisticsService;

    @RequestMapping("logistics-page")
    public String findPage(@RequestParam(required = false,defaultValue = "1") Long current,
                           @RequestParam(required = false,defaultValue = "5") Long size, Model model){
        Page<Logistics> page = logisticsService.findLogisticsPage(new Page<>(current, size));
        model.addAttribute("page",page);
        return "list";
    }
}
